﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.CMS.ViewModels.ReportViewModel>" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
    <%@ Import Namespace="ChoViet.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Thống kê lượt view hàng ngày
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form action="/Report/IndexCms" method="post" name="adminForm">
    <table width="100%">
        <tr>
            <td align="left">
                Thống kê Từ ngày: <%=Html.TextBoxFor(m =>m.Fromdate,new {@class = "datepicker", style = "width:90px" })%>
                Đến ngày: <%=Html.TextBoxFor(m => m.Todate, new { @class = "datepicker", style = "width:90px" })%>
                <%= Html.ActionImageJS("Tìm kiếm", "icon-32-search.png", "document.adminForm.submit();", false)%>
            </td>
        </tr>
    </table>
    <table width="100%" class="adminlist">
        <tbody>
            <tr>
                <td>
                    <%
						System.Web.UI.DataVisualization.Charting.Chart Chart1 = new System.Web.UI.DataVisualization.Charting.Chart();
                        Chart1.Width = 900;
                        Chart1.Height = 400;
                        Chart1.RenderType = RenderType.ImageTag;

                        Chart1.Palette = ChartColorPalette.BrightPastel;
                        Title t1 = new Title("Thống kê lượng VIEW hàng ngày", Docking.Top, new System.Drawing.Font("Trebuchet MS", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.Green);
                        Chart1.Titles.Add(t1);
                        Chart1.ChartAreas.Add("ChartAreas");
                        Chart1.ChartAreas["ChartAreas"].AxisX.IsMarginVisible = false;
						// create a couple of series
                        Chart1.Series.Add("Series 1");
                        Chart1.Series["Series 1"].ChartType = SeriesChartType.SplineArea;
                        Chart1.Series["Series 1"].IsValueShownAsLabel = true;
                        Chart1.Series["Series 1"].MarkerStyle = MarkerStyle.Circle;
                        Chart1.Series["Series 1"].MarkerColor = System.Drawing.Color.FromArgb(5, 141, 199);
                        Chart1.Series["Series 1"].Color = System.Drawing.Color.FromArgb(230,244,249);
                        Chart1.Series["Series 1"].BorderColor = System.Drawing.Color.FromArgb(5, 141, 199);
						// add points to series 1
                        foreach (var item in Model.Counters)
                        {
                            Chart1.Series["Series 1"].Points.AddXY(string.Format("{0:dd/MM}", item.AddDate), string.Format("{0:#.#}",double.Parse(item.Visited.Value.ToString())));
                        }

                        Chart1.BorderSkin.SkinStyle = BorderSkinStyle.None;
                        Chart1.BorderColor = System.Drawing.Color.Red;
                        Chart1.BorderlineDashStyle = ChartDashStyle.Solid;
                        Chart1.BorderWidth = 2;

						// Render chart control
                        Chart1.Page = this;
						HtmlTextWriter writer1 = new HtmlTextWriter(Page.Response.Output);
						Chart1.RenderControl(writer1);
                     %>
                </td>
            </tr>
            
            <tr>
                <td>
                    <%
						System.Web.UI.DataVisualization.Charting.Chart Chart2 = new System.Web.UI.DataVisualization.Charting.Chart();
                        Chart2.Width = 900;
                        Chart2.Height = 400;
                        Chart2.RenderType = RenderType.ImageTag;

                        Chart2.Palette = ChartColorPalette.BrightPastel;
                        Title t2 = new Title("Thống kê lượng tin rao mới hàng ngày", Docking.Top, new System.Drawing.Font("Trebuchet MS", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.Green);
                        Chart2.Titles.Add(t2);
                        Chart2.ChartAreas.Add("ChartAreas");
                        Chart2.ChartAreas["ChartAreas"].AxisX.IsMarginVisible = false;
						// create a couple of series
                        Chart2.Series.Add("Series 1");
                        Chart2.Series["Series 1"].ChartType = SeriesChartType.SplineArea;
                        Chart2.Series["Series 1"].IsValueShownAsLabel = true;
                        Chart2.Series["Series 1"].MarkerStyle = MarkerStyle.Circle;
                        Chart2.Series["Series 1"].MarkerColor = System.Drawing.Color.FromArgb(5, 141, 199);
                        Chart2.Series["Series 1"].Color = System.Drawing.Color.FromArgb(252, 180, 65);
                        Chart2.Series["Series 1"].BorderColor = System.Drawing.Color.Red;
                        Chart2.Series["Series 1"].BorderWidth = 2;
                        Chart2.Series.Add("Series 2");
                        Chart2.Series["Series 2"].ChartType = SeriesChartType.SplineArea;
                        Chart2.Series["Series 2"].IsValueShownAsLabel = true;
                        Chart2.Series["Series 2"].MarkerStyle = MarkerStyle.Circle;
                        Chart2.Series["Series 2"].MarkerColor = System.Drawing.Color.FromArgb(5, 141, 199);
                        Chart2.Series["Series 2"].Color = System.Drawing.Color.FromArgb(230, 244, 249);
                        Chart2.Series["Series 2"].BorderColor = System.Drawing.Color.FromArgb(5, 141, 199);
						// add points to series 1
                        foreach (var item in Model.ReportNewAds)
                        {
                            Chart2.Series["Series 1"].Points.AddXY(string.Format("{0:dd/MM}", item.CreatedDate), string.Format("{0:#.#}",double.Parse(item.NewAd.Value.ToString())));
                            Chart2.Series["Series 2"].Points.AddXY(string.Format("{0:dd/MM}", item.CreatedDate), string.Format("{0:#.#}", double.Parse(item.NewAdAuto.Value.ToString())));
                        }

                        Chart2.BorderSkin.SkinStyle = BorderSkinStyle.None;
                        Chart2.BorderColor = System.Drawing.Color.Red;
                        Chart2.BorderlineDashStyle = ChartDashStyle.Solid;
                        Chart2.BorderWidth = 2;

						// Render chart control
                        Chart2.Page = this;
						HtmlTextWriter writer2 = new HtmlTextWriter(Page.Response.Output);
						Chart2.RenderControl(writer2);
					
                     %>
                </td>
            </tr>
        </tbody>
    </table>
    </form>
    <script type="text/javascript">
        $.datepicker.setDefaults($.datepicker.regional['vi']);
        $(".datepicker").datepicker({
            dateFormat: "dd/mm/yy",
            changeMonth: true,
            yearRange: "1920",
            showOn: "button",
            buttonImage: "/Images/calendar.gif",
            buttonImageOnly: true,
            changeYear: true
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
<td>
	<%= Html.Toolbar("Cập nhật báo cáo", "/Report/UpdateReport", "new") %>
 </td>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Thống kê
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
</asp:Content>
